import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn, OneToMany, ManyToOne, JoinColumn, CreateDateColumn } from "typeorm";
import { BaseEntity } from 'src/common/entities/base';
import { KzSiteEntity } from "./kz-site.entity";

@Entity('kz_account', {
    comment: '快站账号信息表',
})
export class KzAccountEntity extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({ type: 'varchar', name: 'account', length: 30, comment: '账号' })
    public account: string;

    @Column({ type: 'varchar', name: 'password', length: 100, comment: '密码' })
    public password: string;

    @Column({ type: 'varchar', name: 'app_key', length: 100, comment: 'APP_KEY' })
    public appKey: string;

    @Column({ type: 'varchar', name: 'app_secret', length: 100, comment: 'APP_SECRET' })
    public appSecret: string;

    @Column({ type: 'int', name: 'site_count',  default: null, comment: '账号下的站点数量' })
    public siteCount: number;

    @OneToMany(() => KzSiteEntity, site => site.account)
    siteIds: KzSiteEntity[];
}
